{% extends "v1/base.html" %}
{% block content %}

{% for item in data  %}      
    {% if item['show'] %} 
        <div id="{{ item['key'] }}" class="data"></div>
        <!-- 时间轴单位-{{ item['value'] }}-->
        <script type="text/javascript">
            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById("{{ item['key'] }}"));  
            
            function randomData() {
                return Math.round(Math.random()*1000);
            }
            
            var dateStr = "{{ item['x'] }}";
            var xAxisList = dateStr.split(';');
            var xAxisData = [];

            xAxisList.forEach(function (element) {
                xAxisData.push(element);
            });    
            option = {
                    <!-- dataZoom: [ -->
                            <!-- { -->
                                <!-- type: 'slider', -->
                                <!-- xAxisIndex: 0, -->
                                <!-- start: 0, -->
                                <!-- end: 100 -->
                            <!-- }, -->
                            <!-- { -->
                                <!-- type: 'inside', -->
                                <!-- xAxisIndex: 0, -->
                                <!-- start: 0, -->
                                <!-- end: 100 -->
                            <!-- } -->
                        <!-- ],   -->
                    tooltip: {
                        trigger: 'axis'
                    },
                    title: {
                        text: '审批通过率-{{ item['value'] }}',
                        subtext: '',
                        left: 'left'
                    },  
                    legend: {
                        data:['审批通过率(%)']
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        feature: {
                            dataView: {show: true, readOnly: false},
                            magicType: {show: true, type: ['line', 'bar']},
                            restore: {show: true},
                            saveAsImage: {show: true}
                        }
                    },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data: xAxisData
                    },
                    yAxis: {
                        type: 'value',
                        max: 110
                    },
                    series: [
                        {
                            name:'审批通过率(%)',
                            type:'line',                                            
                            //stack: '总量',
                            data:{{ item['y'] }}
                        }             
                    ]
                };
            // 使用刚指定的配置项和数据显示图表。  
            myChart.setOption(option); 
        </script>

    {% endif  %} 
{% endfor %}
   
{% endblock %}